using System;
using SmartPeople.Framework.SecuritySpace;

namespace SmartPeople.Framework.SecuritySpace
{
    public interface ISecurityPermissionsProvider
    {
        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <value>The count.</value>
        int Count { get; }

        /// <summary>
        /// Gets the type of the access.
        /// </summary>
        /// <param name="roleID">The role ID.</param>
        /// <param name="documentID">The document ID.</param>
        /// <param name="actionID">The action ID.</param>
        /// <param name="stateID">The state ID.</param>
        /// <returns></returns>
        AccessType GetAccessType(Guid roleID, Guid documentID, Guid actionID, Guid stateID);


        /// <summary>
        /// Gets the permission.
        /// </summary>
        /// <param name="roleID">The role ID.</param>
        /// <param name="documentID">The document ID.</param>
        /// <param name="actionID">The action ID.</param>
        /// <param name="stateID">The state ID.</param>
        /// <returns></returns>
        ISecurityPermission GetPermission(Guid roleID, Guid documentID, Guid actionID, Guid stateID);

        /// <summary>
        /// Gets the permissions.
        /// </summary>
        /// <param name="roleID">The role ID.</param>
        /// <param name="documentID">The document ID.</param>
        /// <returns></returns>
        ISecurityPermission[] GetPermissions(Guid roleID, Guid documentID);

        /// <summary>
        /// Creates the permission.
        /// </summary>
        /// <param name="roleID">The role ID.</param>
        /// <param name="documentID">The document ID.</param>
        /// <param name="actionID">The action ID.</param>
        /// <param name="stateID">The state ID.</param>
        /// <param name="accessType">Type of the access.</param>
        /// <returns></returns>
        ISecurityPermission CreatePermission(Guid roleID, Guid documentID, Guid actionID, Guid stateID,
                                             AccessType accessType);

        /// <summary>
        /// Updates the permission.
        /// </summary>
        /// <param name="permission">The permission.</param>
        /// <returns></returns>
        bool UpdatePermission(ISecurityPermission permission);

        /// <summary>
        /// Deletes the permission.
        /// </summary>
        /// <param name="permissionID">The permission ID.</param>
        /// <returns></returns>
        bool DeletePermission(Guid permissionID);


        /// <summary>
        /// Deletes the permission.
        /// </summary>
        /// <param name="permission">The permission.</param>
        /// <returns></returns>
        bool DeletePermission(ISecurityPermission permission);


        /// <summary>
        /// Deletes the permission.
        /// </summary>
        /// <param name="roleID">The role ID.</param>
        /// <param name="documentID">The document ID.</param>
        /// <param name="actionID">The action ID.</param>
        /// <param name="stateID">The state ID.</param>
        /// <returns></returns>
        bool DeletePermission(Guid roleID, Guid documentID, Guid actionID, Guid stateID);

        //TODO:abm created
        bool DeletePermission(Guid roleID, Guid documentID, Guid actionID);

        //TODO:abm created
        bool DeletePermission(Guid roleID, Guid documentID);


        /// <summary>
        /// Determines whether [is any granted] [the specified role I ds].
        /// </summary>
        /// <param name="roleIDs">The role I ds.</param>
        /// <param name="documentID">The document ID.</param>
        /// <param name="actionID">The action ID.</param>
        /// <param name="stateID">The state ID.</param>
        /// <returns>
        /// 	<c>true</c> if [is any granted] [the specified role I ds]; otherwise, <c>false</c>.
        /// </returns>
        bool IsAnyGranted(Guid[] roleIDs, Guid documentID, Guid actionID, Guid stateID);

        /// <summary>
        /// Clears this instance.
        /// </summary>
        void Clear();

        #region Methods to review / remove.

        //bool IsGranted(Guid roleID, Guid documentID, Guid actionID, Guid stateID);
        //bool RevokePermission(Guid roleID, Guid documentID, Guid actionID, Guid stateID);

        //bool DeletePermissionsForRole(Guid roleID,Guid documentID);
        //bool DeletePermissionsForRole(Guid roleID, Guid documentID, Guid actionID);
        //ISecurityPermission[] GetPermissions(Guid roleID, Guid documentID, Guid actionID, Guid stateID); 

        #endregion
    }
}